﻿using System;
using System.Net;
using System.Web.Mvc;

namespace BrettM.Web.Http
{


    public class HttpResult 
        : ViewResult
    {

        
        private readonly HttpStatusCode _statusCode;

        public HttpResult(HttpStatusCode statusCode) 
        {
            this.ViewName = "ShowError";
            _statusCode = statusCode;
        }

        public override void ExecuteResult(ControllerContext context)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            context.HttpContext.Response.StatusCode = (int)_statusCode; 
            base.ExecuteResult(context);

            
        }
    }
}
